{template "header.html"}

<form class="form-horizontal" method="post" role="form" id="myform">
    {$form}
    <div class="form-body">

        <div class="form-group">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('模式')}</label>
            <div class="col-xs-8">
                <div class="mt-radio-inline">
                    <label class="mt-radio mt-radio-outline"><input onclick="rr(this.value)" type="radio" name="type" value="0" {if $data.host != 'mail'}checked=""{/if}> SMTP <span></span></label>
                    <label class="mt-radio mt-radio-outline"><input onclick="rr(this.value)" type="radio" name="type" value="1" {if $data.host == 'mail'}checked=""{/if}> Mail <span></span></label>
                </div>
            </div>
        </div>
        <div class="form-group mail" style="display: none">
            <label class="col-xs-3 control-label ajax_name"></label>
            <div class="col-xs-8">
                <span class="help-block">{dr_lang('Mail模式表示由当前服务器发出邮件，需要服务器的支撑。')}</span>
                <span class="help-block">{dr_lang('由Mail模式发送的邮件，被拦截的几率比较大，请慎用。')}</span>
            </div>
        </div>
        <div class="form-group smtp" id="dr_row_host">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('服务器')}</label>
            <div class="col-xs-8">
                <input type="text" class="form-control" id="dr_host" name="data[host]" value="{htmlspecialchars((string)$data.host)}">
                <span class="help-block">{dr_lang('由邮件运营商提供，若使用ssl协议请使用ssl://开头，例如：ssl://smtp.exmail.qq.com')}</span>
            </div>
        </div>
        <div class="form-group smtp" id="dr_row_port">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('端口号')}</label>
            <div class="col-xs-8">
                <input type="text" class="form-control" id="dr_port" name="data[port]" value="{htmlspecialchars((string)$data.port)}">
                <span class="help-block">{dr_lang('普通协议一般是25，ssl协议一般是465')}</span>
            </div>
        </div>
        <div class="form-group" id="dr_row_user">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('邮箱账号')}</label>
            <div class="col-xs-8">
                <input type="text" class="form-control" id="dr_user" name="data[user]" value="{htmlspecialchars((string)$data.user)}">
                <span class="help-block">{dr_lang('登录邮件系统的账号名称')}</span>
            </div>
        </div>
        <div class="form-group smtp" id="dr_row_pass">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('邮箱密码')}</label>
            <div class="col-xs-8">
                <input type="text" class="form-control" id="dr_pass" name="data[pass]" value="{htmlspecialchars((string)$data.pass)}">
                <span class="help-block">{dr_lang('登录邮件系统的账号密码')}</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('排列顺序')}</label>
            <div class="col-xs-8">
                <input type="text" id="displayorder" class="form-control" name="data[displayorder]" value="{intval($data.displayorder)}">
                <span class="help-block"> {dr_lang('排序值由小到大排列，范围为0-255')} </span>
            </div>
        </div>
    </div>
</form>

<link href="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/fuelux/js/spinner.min.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        $("#displayorder").TouchSpin({
            buttondown_class: "btn red",
            buttonup_class: "btn green",
            min: -255,
            max: 255
        });
        {if $data && $data.host == 'mail'}
        rr(1);
        {/if}
    });
    function rr(v) {
        if (v == 0) {
            $('.smtp').show();
            $('.mail').hide();
        } else {
            $('.smtp').hide();
            $('.mail').show();
        }
    }
</script>
{template "footer.html"}